package com.wujunshen.algorithm.leetcode.basic;

/**
 * @author frank woo(吴峻申) <br>
 *     email:<a href="mailto:frank_wjs@hotmail.com">frank_wjs@hotmail.com</a> <br>
 * @date 2022/7/24 17:14<br>
 */
public class 反转链表 {
  public ListNode reverseList(ListNode head) {
    ListNode pre = null;
    ListNode temp = null;
    while (head != null) {
      temp = head.next;
      head.next = pre;
      pre = head;
      head = temp;
    }
    return pre;
  }
}
